package com.luhe.midi.helper;

import com.luhe.midi.MidiFile;

import java.io.IOException;
import java.io.Writer;
/*
头部：M T h d ->
类型：1 ->
轨道：1 ->
时间：120 ->
 */

//把midifile转换到csv调试文本格式
public class MIDIFileLogWriter {
    MidiFile midiFile;

    public MIDIFileLogWriter(MidiFile midiFile) {
        this.midiFile = midiFile;
    }

    public void write(Writer writer) throws IOException {
        writer.write("头部：" + ByteUtil.printByte(midiFile.getmThd().getInnerBytes(), 0, 7) + "\n");
        writer.write("类型：" + ByteUtil.printByte(midiFile.getmThd().getInnerBytes(), 8, 9) + "\n");
        writer.write("数目：" + ByteUtil.printByte(midiFile.getmThd().getInnerBytes(), 10, 11) + "\n");
        writer.write("时间：" + ByteUtil.printByte(midiFile.getmThd().getInnerBytes(), 12, 13) + "\n");
        writer.flush();
    }
}
